
<?php include("session.php"); ?>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>编辑客户信息</title>
	<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../themes/icon.css">
	<link rel="stylesheet" type="text/css" href="../demo.css">
	<script type="text/javascript" src="../jquery.min.js"></script>
	<script type="text/javascript" src="../jquery.easyui.min.js"></script>
</head>
<body  onunload="window.opener.fresh()" >	

			
		
		<div class="easyui-accordion" style="width:400px;height:300px">
		
		
	
		<div title="客户管理"  style="overflow:auto;padding:10px;">
				
		
					
	
					
				<form id="ff" method="post">
		<table border="1px" cellspacing="0px"  style="margin:auto;border-collapse:collapse" >
				<tr align = center height=30px>
					<td align = left width = 100px bgcolor="#edf4ff"><b>名称:</b></td>
					<td><input class="easyui-validatebox textbox" id="name" style="text-align:center;border:1;text-align:center;" type="text" name="name" value=""  maxlength="10" ></input></td>

				</tr>
				
				<tr align = right height=30px>
					<td align = left width = 200px bgcolor="#edf4ff"><b>父机构名称:</b></td>
					<td><input class="easyui-validatebox textbox" id="parent" style="text-align:center;border:1;" type="text" name="name" value=""   disabled="disabled"></input></td>

				</tr>
								
	<!--  			<tr align = right height=30px>
					<td align = left width = 200px bgcolor="#edf4ff"><b>经度:</b></td>
					<td><input class="easyui-validatebox textbox" id="lon" style="text-align:center;border:1;" type="text" name="name" value="" ></input></td>

				</tr>
		
				<tr align = right height=30px>
					<td align = left width = 200px bgcolor="#edf4ff"><b>纬度:</b></td>
					<td><input class="easyui-validatebox textbox" id="lat" style="text-align:center;border:1;" type="text" name="name" value="" ></input></td>

				</tr>	 -->

			</table>
			</form>
			
			
			<script>
			
			
			    var query = location.search.substring(1);
			    var values= query.split("&");
			    for(var i = 0; i < values.length; i++) {
			        var pos = values[i].indexOf('=');
			        if (pos == -1) continue;
			        var paramname = values[i].substring(0, pos);
			        var value = values[i].substring(pos+1);
			        
			    }
		     
			   
	$.post("../../zend_obd/jsonAPI/customerID.php",
			{
			id:value
		
			},
			function (data,status){
				var rows = eval(data);
				
				
				$("#name").val(rows[0].name);
				$("#parent").val(rows[0].parentName);
				$("#lon").val(rows[0].lon);
				$("#lat").val(rows[0].lat);				
			});

	

		function show_set(){
		var one = $("#name").val();
		if(one==""){
			alert("请输入客户名称!");
			return ;
		}
		var two = $("#parent").val();
		var three = $("#lon").val();
		var four = $("#lat").val();
		$.post("../../zend_obd/jsonAPI/updata_customer.php",
				{
			userID:value,name:one,parent:two,lon:three,lat:four
				},
				function(data,status){
					
					var rows = eval(data);
					
					if(rows=="200"){
						alert("修改成功");
						window.close();
					}else if(rows=="1002"){
						alert("客户名存在！");
					}
				});
		}
		
		
</script>
					
					
<table>	
<tr>
<td width = 100px></td>
<td width = 200px align = center>	
		<input type="button" name="Submit" value="保存编辑" onclick="show_set();"/>
		<input type="button" name="Submit" value="关闭" onclick="javascript:window.close();"/>
</td>
<td align = center>

</td>
</tr>
</table>
			
		</div>

		</div>


	

</body>
</html>
	
	